package financeiro.web.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import financeiro.entity.Email;

@FacesConverter("EmailConverter")
public class EmailConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		Email email = null;
		if (arg2 != null) {
			email = new Email();
			email.setEndereco(arg2);
		}
		return email;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		String valor = null;
		Email email = (Email) arg2;
		if (email != null) {
			valor = email.getEndereco();
		}
		return valor;
		return null;
	}

}
